#define _CRT_SECURE_NO_WARNING
#include"list.h"


void test_zsslist1()
{
	zss::list<int> lt1;
	lt1.push_back(1);
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);
	zss::list<int>::iterator it = lt1.begin();
	while (it != lt1.end())
	{
		cout << *it << " ";
		++it;
	}
}

struct A
{
	A(int a1 = 1, int a2 = 1)
		:_a1(a1)
		, _a2(a2)
	{
	}

	int _a1;
	int _a2;
};
void test_zsslist2()
{
	zss::list<A> lt2;
	lt2.push_back({ 1,1 });
	lt2.push_back({ 2,2 });
	lt2.push_back({ 3,3 });
	lt2.push_back({ 4,4 });
	zss::list<A>::iterator it = lt2.begin();
	while (it != lt2.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << endl;
		cout << it->_a1 << ":" << it->_a2 << endl;
		++it;
	}
	cout << endl;
}
void test_zsslist3()
{
	zss::list<int> lt1;
	lt1.push_back(1);
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);

	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;

	lt1.push_front(5);
	lt1.push_front(6);

	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;

	lt1.pop_back();
	lt1.pop_back();
	lt1.pop_front();
	lt1.pop_front();

	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;

	lt1.pop_back();
	lt1.pop_back();
	//lt1.pop_back();

	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;
}
void test_zsslist4()
{
	zss::list<int> lt1;
	lt1.push_back(1);
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);

	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;

	zss::list<int> lt2(lt1);

	lt1.clear();
	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;

	for (auto e : lt2)
	{
		cout << e << " ";
	}
	cout << endl;

	zss::list<int> lt3 = { 10,20,30,40 };
	/*lt3.push_back(10);
	lt3.push_back(20);
	lt3.push_back(30);
	lt3.push_back(40);*/

	lt1 = lt3;
	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;
}
int main()
{
	//test_zsslist1();
	//test_zsslist2();
	//test_zsslist3();
	test_zsslist4();

	return 0;
}